package com.ctshk.sapp.system.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.system.dto.ScenicProdutTypeIncoDTO;
import com.ctshk.rpc.system.req.MainDataScenicProductTypeAddReq;
import com.ctshk.rpc.system.service.IMainScenicProductTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  城市-机场 主数据前端控制器
 * </p>
 *
 * @author lihang
 * @since 2021-03-18
 */
@Api(value = "主数据-景点门票类型")
@RestController
@RequestMapping("/main-product-type-fun")
public class MainScenicProductTypeFunController extends BaseController {


    @DubboReference
    private IMainScenicProductTypeService iMainScenicProductTypeService;


    @ApiOperation(value = "景点门票类型列表", notes = "查询景点门票类型列表")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.QUERY, operTitle = "景点门票类型列表", operDesc = "景点门票类型列表")
    @PostMapping(value="/list")
    public Result<PageResponse<ScenicProdutTypeIncoDTO>> list(@RequestBody @Valid MainDataScenicProductTypeAddReq req){
        return iMainScenicProductTypeService.list(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "景点门票类型列表", notes = "查询景点门票类型列表")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.QUERY, operTitle = "景点门票类型列表", operDesc = "景点门票类型列表")
    @PostMapping(value="/getTypeList")
    public Result<PageResponse<ScenicProdutTypeIncoDTO>> getTypeList(@RequestBody @Valid MainDataScenicProductTypeAddReq req){
        return iMainScenicProductTypeService.getTypeList(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "新增景点门票类型", notes = "新增景点门票类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.ADD, operTitle = "新增景点门票类型", operDesc = "新增景点门票类型")
    @PostMapping(value="/add")
    public Result add(@RequestBody @Valid MainDataScenicProductTypeAddReq req){
        return  iMainScenicProductTypeService.add(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "修改景点门票类型", notes = "修改景点门票类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "编辑景点门票类型", operDesc = "编辑景点门票类型")
    @PostMapping(value="/edit")
    public Result edit(@RequestBody @Valid MainDataScenicProductTypeAddReq req){
        return  iMainScenicProductTypeService.edit(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "獲取景点门票类型主數據", notes = "修改景点门票类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "獲取景点门票类型主數據", operDesc = "獲取景点门票类型主數據")
    @PostMapping(value="/get-fun-type")
    public Result getFunType(){
        return iMainScenicProductTypeService.getFunType();
    }


    @ApiOperation(value = "設置狀態", notes = "修改景点门票类型")
    @OperationLogAnnotation(operModul = OperationLogModel.LOCALFUN, operType = OperationLogType.UPDATE, operTitle = "設置狀態", operDesc = "設置狀態")
    @PostMapping(value="/updateStatus")
    public Result updateStatus(@RequestBody MainDataScenicProductTypeAddReq mainDataScenicProductTypeAddReq){
        return iMainScenicProductTypeService.updateStatus(mainDataScenicProductTypeAddReq);
    }

}
